﻿namespace UnionnetClient.Model
{
	enum LoginStateType
	{
		/// <summary>
		/// 未登陆
		/// </summary>
		NoLogin,
		/// <summary>
		/// 正在登陆
		/// </summary>
		Logining,
		/// <summary>
		/// 登陆成功
		/// </summary>
		Successful,
		/// <summary>
		/// 重复登陆
		/// </summary>
		Repetition, 
		/// <summary>
		/// 密码错误
		/// </summary>
		PasswordWrong, 
		/// <summary>
		/// 登陆失败
		/// </summary>
		Failed,
		/// <summary>
		/// 登陆超时
		/// </summary>
		Timeout,
		/// <summary>
		/// 登陆被取消
		/// </summary>
		Canceled,
		/// <summary>
		/// 网络异常
		/// </summary>
		Execption,
		/// <summary>
		/// 未知的
		/// </summary>
		Unknown,
	}

	enum StartupState
	{
		Unconfig,
		Connected,
	}

	internal class LoginParameter
	{
		private string postAddress;
		private string postParemeters;
		//private LoginStateType errorType;
		private int interval;

		public LoginParameter(string postAddress, string postParemeters, int interval)
		{
			this.postAddress = postAddress;
			this.postParemeters = postParemeters;
			this.interval = interval;
		}

		//public LoginParameter(string postAddress, string postParemeters)
		//    : this(postAddress, postParemeters, 10000)
		//{
		//}

		public string PostAddress
		{
			get { return postAddress; }
		}

		public string PostParemeters
		{
			get { return postParemeters; }
		}

		//public LoginStateType ErrorType
		//{
		//    get { return errorType; }
		//    set { errorType = value; }
		//}

		public int Interval
		{
			get { return interval; }
			set { interval = value; }
		}
	}

	public class ConnectChangedEventArgs : System.EventArgs
	{
		private bool connected;

		public bool IsConnected
		{
			get { return connected; }
		}

		public ConnectChangedEventArgs(bool isConnected)
		{
			this.connected = isConnected;
		}
	}

	public class GetLoginSourceCompletedEventArgs : System.EventArgs
	{
		private bool success;
		private string source;

		public bool Successful
		{
			get { return success; }
		}

		public string Source
		{
			get { return source; }
		}

		public GetLoginSourceCompletedEventArgs(bool success, string source)
		{
			this.success = success;
			this.source = source;
		}

		public GetLoginSourceCompletedEventArgs(bool success)
			: this(success, string.Empty)
		{
		}
	}

	public delegate void DoSomething();
}